<style>
.label-gray {
	line-height:2.2;
	background-color:#f5f7fb;
	border: 1px solid #f5f7fb;
	color:#999;
	margin-right:0.3rem;
    font-size: 100%;
}
.label-gray.active {
	background-color:#fff;
	color:{{main.syscolor || '#7c1cc9'}};
	border: 1px solid {{main.syscolor || '#7c1cc9'}};
}
</style>
<div class="radius">
		<div class="fui-cellone" style="padding:0.5rem">
				 <div class="fui-cellone-info">
					<div class="search-input" style="height:1.6rem">
						<form action="javascript:return true">
						<i id="searchsub" class="icon icon-sousuo1 bold" ng-click="tool.get_list('/mcpitem/getmymp3list/',true)" style="line-height: 1.7rem;"></i>
						<input type="search" placeholder="请输入音乐名称" class="search" ng-model="pagedata.params.keyword" style="height:1.6rem;border: 0;text-align: left; color: #999; font-size:0.6rem;background:#f2f2f2;border-radius: 1rem;" />
						</form>
					</div>
				 </div>
				 <div class="fui-cellone-remark noremark">
					<span style="margin-left:0.3rem;font-size: 0.75rem;" ng-click="tool.get_list('/mcpitem/getmymp3list/',true)">搜索</span>
				 </div>
		</div>
		<div class="fui-tab fui-tab-danger" style="background:none;margin-top:0">
			<a href="javascript:" ng-click="pagedata.params.ismymp3 = 0;tool.get_list('/mcpitem/getmp3log/',true)" ng-class="{'external active':pagedata.params.ismymp3 != 1}">当前播放</a>
			<a href="javascript:" ng-click="pagedata.params.ismymp3 = 1;tool.get_list('/mcpitem/getmymp3list/',true)" ng-class="{'external active':pagedata.params.ismymp3 == 1}">我的歌单</a>
		</div>
		<div ng-if="pagedata.params.ismymp3 == 1" style="padding-top: 0.5rem;">
			<div class="c">
				<div class="weui_btn_area" style="margin-top:0">
					<a class="weui_btn weui_btn_primary jy-btn1" style="color:#354fe2;" href="javascript:" id="showTooltips" href="javascript:;" ng-click="pagedata.showaddmp3=true;pagedata.get_addmp3list();"><i class="icon icon-tianjia"></i> 搜索添加</a>
				</div>
			</div>
		</div>
		<div class="fui-cell-group radius" ng-repeat="item in pagedata.list">
		<div class="fui-cell">
		<div class="fui-cell-lable" style="width: 1rem;">{{$index+1}}</div>
		<div class="fui-cell-text">
			<div class="fui-cellone" style="padding: 0.2rem 0;">
				<div class="fui-cellone-text">
					<div class="text bold">
					{{item.title}}
					</div>
				</div>
				<div class="fui-cellone-remark noremark gray">
					<span ng-if="$index==0 && pagedata.params.ismymp3 != 1">正在播放 </span><span> {{item.duration || '00:00'}}</span>
				</div>
			</div>
			<div class="gray" style="font-size:0.65rem">
			{{item.artist ||'***'}} {{item.album ||item.title}}
			</div>
		</div>
		<div class="fui-cell-remark noremark" style="padding-left: 0.5rem;">
			<i class="icon icon-shanchu1" ng-click="pagedata.delmp3($index)" style="font-size:0.85rem;color:red"></i>
		</div>
		</div>
		</div>
		<div class="content-empty" ng-show="!pagedata.list || pagedata.list.length == 0 ">
			<div style="padding-top:0.3rem;color: #999;font-size: .75rem">您暂时没有音乐</div>
		</div>
</div>
<div ng-include="sys_html('common/_addmp3')"></div>
<script>
scope.pagedata.delmp3=function(index){
	scope.pagedata.showbgmp3=false
	scope.$evalAsync();
}
</script>
<script>
scope.pagedata.get_addmp3list=function(isfirst){
		if(!scope.pagedata.params){
			scope.pagedata.params={};
		}
		scope.pagedata.params.mp3page=1;
		scope.pagedata.addmp3list=[];
		var url='/mcpitem/getmp3list/';
		$('#loading_show').show();
		if(typeof(url)!='object'){
			url=scope.tool.links(url);
		}
		var query=scope.made_query(scope.pagedata.params);
		if(url.query){
			url.query+='&'+query;
		}else{
			url.query=query;
		}
		//console.log('query');console.log(query);
		scope.get(url,function(res){
			console.log(res);
			scope.pagedata.loading=false;
			$('#loading_show').hide();
			if(!scope.pagedata.addmp3list || isfirst){
				scope.pagedata.addmp3list=[];
			}
			if(res=='none'){
				scope.pagedata.loaded=true;
				return;
			}
			if(!Array.isArray(res)){
				var addmp3list=res.list?res.list:[]
			}else{
				var addmp3list=res
			}
			if(addmp3list.length==0 || (scope.pagedata.psize && addmp3list.length<scope.pagedata.psize)){
				scope.pagedata.loaded=true;
			}
			if(addmp3list && addmp3list != 'null' && addmp3list != 'undefined'){
				for(let key in addmp3list){
					scope.pagedata.addmp3list.push(addmp3list[key]);
				}
			}
		});
}
scope.pagedata.addmp3=function(item){
	scope.post_json('jy_agentmcp/mcpitem/addmp3/mcpid='+scope.pagedata.item.id,item);
}
</script>